1. Field of the Invention
This invention relates to an optimization control apparatus and an optimization control method for array descriptions which promote the generation of more appropriate codes for new array descriptions added as a new language specification such as FORTRAN 90 stipulated by JIS X 3001 [X3.198 according to ANSI (American National Standards of Institute), and also ISO/IEC 1539:1991]. In those machines which do not have a vector processor such as a computer system, the new array descriptions described above are expanded into one or a plurality of loops inside a compiler for converting a text (generally called a "source text") as an input, such as a source program, to an object program (program in a machine language). Because the portion of the loops in the object program occupies a large proportion in the execution time, the generation of codes associated with the array descriptions under the optimum state greatly contributes to a reduction of the execution time. The present invention deals with one measure for accomplishing the reduction of the execution time, with regard to the new array descriptions added to the original array descriptions as a language specification which must be established for versatile utilization in various fields.
It has been confirmed that the present invention is effective for not only FORTRAN 90 described above but also for all the languages having a language specification for which a given array description is possible, and this suggests a versatile utility of the optimization control apparatus and the optimization control method of the present invention.
2. Description of the Related Art
The below-mentioned Expression No. 1 represents an example of conventional array descriptions comprising a plurality of statements (expressions) such as an array assignment statement operating an array of text. In the case of the array descriptions which are added, as a new language specification, from FORTRAN 90, for example, operations for the array and the array assignments can be described without using a loop control statement such as a DO statement, as shown in the right-hand portion of the following Expression No. 1:
______________________________________ Expression No. 1 ______________________________________ Initialization of Array A Initialization of Array A using DO statement using array description .dwnarw. .dwnarw. REAL(KIND=4)::A(10) REAL(KIND=4)::A(10) DO I = 1, 10 A(I) = 1 A = 1 ENDDO END ______________________________________
As described above, the array descriptions are converted to the loop (or loops) and are executed inside the compiler. If conversion of the array descriptions to the loop is carried out statement by statement at this time, execution performance is very low. Therefore, an optimization control referred to as a "loop merge" is generally executed. In other words, as shown in the right-hand portion of the following Expression No. 2, the array descriptions which can be executed by the same loop (the left-hand portion of Expression No. 2) are gathered and by doing so, the specific portion of the array descriptions can be converted so that it can be executed by the same loop:
______________________________________ Expression No. 2 ______________________________________ REAL(KIND = 4)::A(10), B(10) A = 1 B = 2 END .dwnarw. when loop merge is not when loop merge is executed executed .dwnarw. .dwnarw. expanded image of array descriptions .dwnarw. .dwnarw. REAL(KIND=4)::A(10), B(10) REAL(KIND=4)::A(10), B(10) DO I = 1, 10 DO I = 1, 10 A(I) = 1 A(I) = 1 ENDDO B(I) = 2 DO I = 1, 10 ENDDO B(I) = 2 END ENDDO END ______________________________________
However, an optimization control means according to the prior art cannot execute a loop merge for the array descriptions whose subscript expressions representing the respective forms are different from each other, because the forms of the array descriptions are regarded as unequal to each other, as expressed by the following Expression No.
______________________________________ Expression No. 3 Array description for which loop merge cannot be executed by optimization control of the prior art because subscript expressions representing forms are different from each other .dwnarw. REAL(KIND = 4)::A(10), B(10), C(10) ______________________________________ A(1:L) = B(2:M) . . . (1) B(2:M) = C(3:N) . . . (2) C(3:N) = A(1:K) . . . (3) ______________________________________
In order to accomplish a loop merge in the array descriptions according to the optimization control means of the prior art, the forms of the array descriptions must be completely coincident with each other. In other words, the optimization control means according to the prior art can execute a loop merge for only those array descriptions whose forms can be judged as coincident with each other as represented by Expression No. 2 given above. When the form of the loop is defined at the time of execution and the generation of the optimum codes is required by calculation expressions having different forms, the conventional means cannot execute the loop merge.
On the other hand, the conventional optimization control means controls the optimization level by an option. However, whereas there are many cases in which the translation resources required for optimization depend on complicatedness of the source used as the input, this information concerning the complicatedness of the source is not used for controlling the optimization level of the compiler and hence, the translation resources are not effectively utilized.